package org.hy.pay.message.api.impl;

import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hy.pay.common.core.page.PageBean;
import org.hy.pay.common.core.page.PageParam;
import org.hy.pay.message.api.RpTransactionMessageService;
import org.hy.pay.message.dao.RpTransactionMessageDao;
import org.hy.pay.message.entity.RpTransactionMessage;
import org.hy.pay.message.exception.MessageBizException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RpTransactionMessageServiceImpl implements RpTransactionMessageService{
	
	private static final Log log = LogFactory.getLog(RpTransactionMessageServiceImpl.class);
	
	@Autowired
	RpTransactionMessageDao rpTransactionMessageDao;
	
	@Override
	public int saveMessageWaitingConfirm(
			RpTransactionMessage rpTransactionMessage) throws MessageBizException {
			if(rpTransactionMessage == null){
				throw new MessageBizException(MessageBizException.SAVE_MESSAGE_IS_NULL,"保存的消息为空");
			}
		return rpTransactionMessageDao.insert(rpTransactionMessage);
	}

	@Override
	public void confirmAndSendMessage(String messageId) throws MessageBizException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int saveAndSendMessage(RpTransactionMessage rpTransactionMessage)
			throws MessageBizException {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void directSendMessage(RpTransactionMessage rpTransactionMessage)
			throws MessageBizException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void reSendMessage(RpTransactionMessage rpTransactionMessage)
			throws MessageBizException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void reSendMessageByMessageId(String messageId)
			throws MessageBizException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setMessageToAreadlyDead(String messageId)
			throws MessageBizException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public RpTransactionMessage getMessageByMessageId(String messageId)
			throws MessageBizException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void deleteMessageById(String messageId) throws MessageBizException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void reSendAllDeadMessageByQueueName(String queueName, int batchSize)
			throws MessageBizException {
		// TODO Auto-generated method stub
		
	}

	/*@SuppressWarnings("rawtypes")
	@Override
	public PageBean<RpTransactionMessage> listPage(PageParam pageParam, Map paramMap) {
		 return rpTransactionMessageDao.listPage(pageParam, paramMap);
	}*/

    @Override
	public PageBean<RpTransactionMessage> listPage(PageParam pageParam, Map<String, Object> paramMap) {
		return rpTransactionMessageDao.listPage(pageParam, paramMap);
	}

}
